<?php
abstract class EWebby_WebModule {
	public $application;
	
	protected $name;
	protected $enabled = true;
	private $_initialized = false;
	private $_loaded = false;
	
	
	public function getName() {
		return $this->name;
	}
	public function getEnabled() {
		return $this->enabled;
	}
	
	
	protected abstract function onInit();
	public function init() {
		if( $this->_initialized ) {
			return;
		}
		
		$this->_initialized = true;				
		$this->onInit();
	}

	protected abstract function onLoad();
	public function load() {
		if( $this->_loaded ) {
			return;
		}
		
		if( !$this->_initialized ) {
			$this->init();
		}
		
		$this->_loaded = true;
		$this->onLoad();
	}

	protected abstract function onShutdown();
	public function shutdown() {
		$this->onShutdown();
	}	
}